home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / BT_UTIL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  906 b   |  33 lines

  1. /*  bt_util.c - utility functions for BTREE */
  2. #include   "stdio.h"
  3.  
  4. int  clr_mem(p,c,n)            /* clear a memory area */
  5.   char    *p ;                /* start of the memory area */
  6.   int    c ;                /* value to write there */
  7.   int    n ;                /* number of bytes to clear */
  8.   {
  9.      while( n > 0 )
  10.     {  *p = c ;            /* clear current location */
  11.        p = p + 1 ;            /* advance pointer */
  12.        n = n - 1 ;            /* reduce byte count */
  13.     }
  14.   }
  15.  
  16. int  mover(to,from,nbytes)    /* moves bytes allowing for overlap */
  17.   char    *to ;                /* move the data to here */
  18.   char    *from ;             /* move it from here */
  19.   int    nbytes ;            /* number of bytes to move */
  20.   {
  21.      if( from > to )
  22.     {
  23.        while( nbytes > 0 )        /* stop when all bytes moved */
  24.           {  *to = *from ;        /* move a byte */
  25.          to = to + 1 ;        /* advance pointers to and from */
  26.          from = from + 1 ;
  27.          nbytes = nbytes - 1 ;    /* reduce bytes left */
  28.           }
  29.     }
  30.   }
  31.  
  32.  
  33.